package com.timesheet.server.core.models;

import java.io.Serializable;
import java.util.Collection;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;

@Entity
public class Student implements Serializable {
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	@Column(name="EMP_ID")
	private int id;
	private String name;

	@ManyToMany(cascade=CascadeType.ALL)
	@JoinTable(name="EMP_PROJECT_ASSIGNMENT",
			joinColumns={@JoinColumn(name="EMP_ID", referencedColumnName="EMP_ID")},
			 inverseJoinColumns={@JoinColumn(name="PROJ_ID", referencedColumnName="PROJ_ID")})
	private Collection<Department> department;

	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public Collection<Department> getDepartment() {
		return department;
	}

	public void setDepartment(Collection<Department> department) {
		this.department = department;
	}

	public String toString() {
		return "\n\nID:" + id + "\nName:" + name + "\n\n" + department;
	}
}